load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "tenantcostclient",
    srcs = [
        "limiter.go",
        "metrics.go",
        "tenant_side.go",
        "test_utils.go",
        "token_bucket.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/ccl/multitenantccl/tenantcostclient",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/base",
        "//pkg/kv/kvclient",
        "//pkg/kv/kvclient/kvtenant",
        "//pkg/kv/kvpb",
        "//pkg/multitenant",
        "//pkg/multitenant/tenantcostmodel",
        "//pkg/roachpb",
        "//pkg/server",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/sql/execinfra",
        "//pkg/sql/sqlliveness",
        "//pkg/util/log",
        "//pkg/util/metric",
        "//pkg/util/metric/aggmetric",
        "//pkg/util/quotapool",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/util/tracing",
        "//pkg/util/tracing/tracingpb",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_errors//errorspb",
    ],
)

go_test(
    name = "tenantcostclient_test",
    srcs = [
        "limiter_test.go",
        "main_test.go",
        "metrics_test.go",
        "query_ru_estimate_test.go",
        "tenant_side_test.go",
        "tenant_side_unit_test.go",
        "token_bucket_test.go",
    ],
    data = glob(["testdata/**"]),
    embed = [":tenantcostclient"],
    tags = ["no-remote-exec"],
    deps = [
        "//pkg/base",
        "//pkg/ccl",
        "//pkg/ccl/changefeedccl",
        "//pkg/ccl/kvccl/kvtenantccl",
        "//pkg/ccl/multitenantccl/tenantcostserver",
        "//pkg/cloud",
        "//pkg/cloud/nodelocal",
        "//pkg/cloud/nullsink",
        "//pkg/jobs",
        "//pkg/jobs/jobstest",
        "//pkg/keys",
        "//pkg/kv/kvclient/kvtenant",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver",
        "//pkg/multitenant",
        "//pkg/multitenant/multitenantio",
        "//pkg/multitenant/tenantcostmodel",
        "//pkg/roachpb",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/security/username",
        "//pkg/server",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/sql",
        "//pkg/sql/catalog/systemschema",
        "//pkg/sql/distsql",
        "//pkg/sql/execinfra",
        "//pkg/sql/sem/eval",
        "//pkg/sql/sqlliveness",
        "//pkg/sql/sqlliveness/slbase",
        "//pkg/sql/stats",
        "//pkg/testutils",
        "//pkg/testutils/datapathutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/skip",
        "//pkg/testutils/sqlutils",
        "//pkg/testutils/testcluster",
        "//pkg/util",
        "//pkg/util/ctxgroup",
        "//pkg/util/ioctx",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/metric",
        "//pkg/util/metric/aggmetric",
        "//pkg/util/protoutil",
        "//pkg/util/randutil",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_datadriven//:datadriven",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_prometheus_client_model//go",
        "@com_github_stretchr_testify//require",
        "@in_gopkg_yaml_v2//:yaml_v2",
    ],
)
